<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	template="/template/common/commonLayout.xhtml">


	<ui:define name="LeftColumnMenu">
		<section> <aside>
		<h1>Liens du site</h1>
		<img src="resources/images/bulle.png" alt="" id="fleche_bulle" />
		<p id="photo_zozor">
			<img src="resources/images/cd.png" width="200" height="50"
				alt="GameDiscount ?" />
		</p>


		<td>
			<center>
				<f:view>
					<h:form>
						<h:commandLink value="Accueil" action="default" />
					</h:form>
					<h:form>
						<h:commandLink value="Nouveautés" action="listeArticles" />
					</h:form>
					<h:form>
						<h:commandLink value="Meilleurs ventes" action="listeArticles" />
					</h:form>
					<h:form>
						<h:commandLink value="Tous nos jeux" action="listeArticles" />
					</h:form>
					<h:form>
						<h:commandLink value="Panier" action="panier" />
					</h:form>
					<h:form>
						<h:commandLink value="S'enregistrer" action="FormInscription" />
					</h:form>
				</f:view>
			</center>
		</td>
		</aside> </section>
	</ui:define>

	<ui:define name="content">
	<h:form>
	<table>
		<tbody>
			<tr>
				<td> 
				<h:commandLink value="Accueil" action="default"/> 
				</td>
				<td> 
				<h:outputText value=" > "/> 
				</td>
				<td> 
				<h:commandLink value="Panier" action="panier"/> 
				</td>
			</tr>
		</tbody>
	</table>
	</h:form>

		<p:growl id="growl" />
		<p:panel id="panel">

			<h:form>
				<p:dataTable var="cart" value="#{magasinBean.articlesPanier}"
					id="cartList" dynamic="true"
					rowEditListener="#{magasinBean.rowEditListener}"
					onRowEditUpdate="growl">

					<f:facet name="header">
            Vos articles
        </f:facet>

					<p:column headerText="">

						<h:commandLink update="panel" action="#{magasinBean.diminuer}"
							title="Diminuer">

							<p:graphicImage value="resources/images/moins.png" />
							<f:setPropertyActionListener value="#{cart}"
								target="#{magasinBean.selectedCartItem}" />

						</h:commandLink>

					</p:column>
					
					


					<p:column headerText="Qte">
					<h:outputText value="#{cart.quantity}" />
					</p:column>
					
					
					
					 <p:column headerText="">

						<h:commandLink update="panel" action="#{magasinBean.augmenter}"
							title="Augmenter">

							<p:graphicImage value="resources/images/plus.png" />
							<f:setPropertyActionListener value="#{cart}"
								target="#{magasinBean.selectedCartItem}" />

						</h:commandLink>

					</p:column> 
					
					

					<p:column headerText="Nom">
						<h:outputText value="#{cart.item.name}" />
					</p:column>

					<p:column headerText="Choix">
						<h:outputText value="#{cart.paiement}" />
					</p:column>
					<p:column headerText="Changer">
					<h:commandLink update="panel" action="#{magasinBean.changer}"
							title="Changer le type de paiement">

							<p:graphicImage value="resources/images/update.png" />
							<f:setPropertyActionListener value="#{cart}"
								target="#{magasinBean.selectedCartItem}" />

						</h:commandLink>

					</p:column>

					<!-- <p:column headerText="Type d'Achat" style="width:150px">
						<p:cellEditor>
							<f:facet name="output">
								<h:outputText value="#{cart.paiement}" />
							</f:facet>
							<f:facet name="input">
								<h:selectOneMenu value="#{cart.paiement}">
									<f:selectItems value="#{magasinBean.types}" var="type"
										itemLabel="#{type}" itemValue="#{type}" />
								</h:selectOneMenu>
							</f:facet>
						</p:cellEditor>
					</p:column> -->


					<p:column headerText="Prix">
						<h:outputText value="#{cart.prixCourant} euros" />
					</p:column>

					<p:column headerText="Supprimer">

						<h:commandLink update="panel" action="#{magasinBean.supprimer}"
							title="Supprimer">

							<p:graphicImage value="resources/images/delete.png" />
							<f:setPropertyActionListener value="#{cart}"
								target="#{magasinBean.selectedCartItem}" />

						</h:commandLink>

					</p:column>

					<!-- <p:commandButton value="Supprimer" update="panel"
							actionListener="#{magasinBean.supprimer}" /> -->

					<f:facet name="footer">
						<h:outputText value="Total : #{magasinBean.montantTotal} euros" />
					</f:facet>


				</p:dataTable>

				<p:commandButton value="Vider le panier" update="panel" image="resources/images/vider.png" 
					actionListener="#{magasinBean.vider}" />
				<p:commandButton value="Annuler" update="panel" image="resources/images/undo.png" 
					actionListener="#{magasinBean.annuler}" />
				<p:commandButton value="Valider" image="resources/images/valider.png"  actionListener="#{loginMB.valider}" />


			</h:form>
		</p:panel>
	</ui:define>
</ui:composition>
